<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>dev: dev::net::Reactor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">dev
   &#160;<span id="projectnumber">0.2</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classdev_1_1net_1_1_reactor.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="classdev_1_1net_1_1_reactor-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">dev::net::Reactor Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>网络反应器  
 <a href="classdev_1_1net_1_1_reactor.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_reactor_8hpp_source.html">Reactor.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for dev::net::Reactor:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classdev_1_1net_1_1_reactor.png" usemap="#dev::net::Reactor_map" alt=""/>
  <map id="dev::net::Reactor_map" name="dev::net::Reactor_map">
<area href="classdev_1_1net_1_1detail_1_1_e_poll_reactor.html" alt="dev::net::detail::EPollReactor" shape="rect" coords="0,112,177,136"/>
<area href="classdev_1_1net_1_1detail_1_1_select_reactor.html" alt="dev::net::detail::SelectReactor" shape="rect" coords="187,112,364,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a4b7b6ab75371fa1b201a413ea6274c38"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4b7b6ab75371fa1b201a413ea6274c38"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><b>EventType</b> { <br />
&#160;&#160;<b>NONE</b>, 
<b>READ</b> = 0x1, 
<b>WRITE</b> = 0x2, 
<b>EXCEP</b> = 0x4, 
<br />
&#160;&#160;<b>RDWR</b> = READ | WRITE, 
<b>RDEX</b> = READ | EXCEP, 
<b>WREX</b> = WRITE | EXCEP, 
<b>ALL</b> = RDWR | EXCEP
<br />
 }<tr class="separator:a4b7b6ab75371fa1b201a413ea6274c38"><td class="memSeparator" colspan="2">&#160;</td></tr>
</td></tr>
<tr class="memitem:a85fa70df32731c763a16d5fae0013de5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85fa70df32731c763a16d5fae0013de5"></a>enum &#160;</td><td class="memItemRight" valign="bottom"><b>Status</b> { <b>READY</b>, 
<b>RUNNING</b>, 
<b>EXIT</b>
 }<tr class="separator:a85fa70df32731c763a16d5fae0013de5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a53939a07465e8c772b63fb8d31a313ec"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a53939a07465e8c772b63fb8d31a313ec">addSocket</a> (<a class="el" href="classdev_1_1net_1_1_socket.html">Socket</a> *sock, EventType events, <a class="el" href="classdev_1_1net_1_1_socket_event_handler.html">SocketEventHandler</a> *handler)=0</td></tr>
<tr class="memdesc:a53939a07465e8c772b63fb8d31a313ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">添加一个套接字到反应器  <a href="#a53939a07465e8c772b63fb8d31a313ec">More...</a><br /></td></tr>
<tr class="separator:a53939a07465e8c772b63fb8d31a313ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a032df9cb5073c0bbc387e8206c6a8507"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a032df9cb5073c0bbc387e8206c6a8507">removeSocket</a> (<a class="el" href="classdev_1_1net_1_1_socket.html">Socket</a> *sock)=0</td></tr>
<tr class="memdesc:a032df9cb5073c0bbc387e8206c6a8507"><td class="mdescLeft">&#160;</td><td class="mdescRight">移除套接字  <a href="#a032df9cb5073c0bbc387e8206c6a8507">More...</a><br /></td></tr>
<tr class="separator:a032df9cb5073c0bbc387e8206c6a8507"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a82d3315e9f4a00eff67ea868ab7e0b6b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a82d3315e9f4a00eff67ea868ab7e0b6b">tick</a> (int timeout=0)=0</td></tr>
<tr class="memdesc:a82d3315e9f4a00eff67ea868ab7e0b6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">执行一次网络事件  <a href="#a82d3315e9f4a00eff67ea868ab7e0b6b">More...</a><br /></td></tr>
<tr class="separator:a82d3315e9f4a00eff67ea868ab7e0b6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69c9596ef5f394df5824f753e7358685"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a69c9596ef5f394df5824f753e7358685"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a69c9596ef5f394df5824f753e7358685">clean</a> (void)=0</td></tr>
<tr class="memdesc:a69c9596ef5f394df5824f753e7358685"><td class="mdescLeft">&#160;</td><td class="mdescRight">清理反应器 <br /></td></tr>
<tr class="separator:a69c9596ef5f394df5824f753e7358685"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5e00626edea76a086d1db104345ee4ad"><td class="memItemLeft" align="right" valign="top">Status&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a5e00626edea76a086d1db104345ee4ad">getStatus</a> (void) const </td></tr>
<tr class="memdesc:a5e00626edea76a086d1db104345ee4ad"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取反应器状态  <a href="#a5e00626edea76a086d1db104345ee4ad">More...</a><br /></td></tr>
<tr class="separator:a5e00626edea76a086d1db104345ee4ad"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9ddff658f29b6d51a9f06c96a8176766"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a9ddff658f29b6d51a9f06c96a8176766">setStatus</a> (Status status)</td></tr>
<tr class="memdesc:a9ddff658f29b6d51a9f06c96a8176766"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置反应器状态  <a href="#a9ddff658f29b6d51a9f06c96a8176766">More...</a><br /></td></tr>
<tr class="separator:a9ddff658f29b6d51a9f06c96a8176766"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95cff3841403c0c59990a1969e6e62fa"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#a95cff3841403c0c59990a1969e6e62fa">getHeartBeatTime</a> (void) const </td></tr>
<tr class="memdesc:a95cff3841403c0c59990a1969e6e62fa"><td class="mdescLeft">&#160;</td><td class="mdescRight">获取反应器心跳时间  <a href="#a95cff3841403c0c59990a1969e6e62fa">More...</a><br /></td></tr>
<tr class="separator:a95cff3841403c0c59990a1969e6e62fa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba6f59dcdb9f1d73f11e022ef6af502b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classdev_1_1net_1_1_reactor.html#aba6f59dcdb9f1d73f11e022ef6af502b">setHeartBeatTime</a> (int time)</td></tr>
<tr class="memdesc:aba6f59dcdb9f1d73f11e022ef6af502b"><td class="mdescLeft">&#160;</td><td class="mdescRight">设置反应器心跳时间  <a href="#aba6f59dcdb9f1d73f11e022ef6af502b">More...</a><br /></td></tr>
<tr class="separator:aba6f59dcdb9f1d73f11e022ef6af502b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a6e50a384a756df66536ea8ece6f49e96"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6e50a384a756df66536ea8ece6f49e96"></a>
Status&#160;</td><td class="memItemRight" valign="bottom"><b>status_</b></td></tr>
<tr class="separator:a6e50a384a756df66536ea8ece6f49e96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9c320521a84ab99434b4b9e48af5f5da"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9c320521a84ab99434b4b9e48af5f5da"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>heartBeatTime_</b></td></tr>
<tr class="separator:a9c320521a84ab99434b4b9e48af5f5da"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>网络反应器 </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a53939a07465e8c772b63fb8d31a313ec"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool dev::net::Reactor::addSocket </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classdev_1_1net_1_1_socket.html">Socket</a> *&#160;</td>
          <td class="paramname"><em>sock</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">EventType&#160;</td>
          <td class="paramname"><em>events</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classdev_1_1net_1_1_socket_event_handler.html">SocketEventHandler</a> *&#160;</td>
          <td class="paramname"><em>handler</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>添加一个套接字到反应器 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sock</td><td>套接字 </td></tr>
    <tr><td class="paramname">events</td><td>注册的事件 </td></tr>
    <tr><td class="paramname">handelr</td><td>事件处理器 </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classdev_1_1net_1_1detail_1_1_select_reactor.html#a4a6e88b02454504628332d69e29590b7">dev::net::detail::SelectReactor</a>, and <a class="el" href="classdev_1_1net_1_1detail_1_1_e_poll_reactor.html#a17ce65f9c19bf7d3cf577d3fbebef2ef">dev::net::detail::EPollReactor</a>.</p>

</div>
</div>
<a class="anchor" id="a95cff3841403c0c59990a1969e6e62fa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int dev::net::Reactor::getHeartBeatTime </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取反应器心跳时间 </p>
<dl class="section return"><dt>Returns</dt><dd>int </dd></dl>

</div>
</div>
<a class="anchor" id="a5e00626edea76a086d1db104345ee4ad"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">Status dev::net::Reactor::getStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>获取反应器状态 </p>
<dl class="section return"><dt>Returns</dt><dd>Status </dd></dl>

</div>
</div>
<a class="anchor" id="a032df9cb5073c0bbc387e8206c6a8507"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool dev::net::Reactor::removeSocket </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classdev_1_1net_1_1_socket.html">Socket</a> *&#160;</td>
          <td class="paramname"><em>sock</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>移除套接字 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sock</td><td>套接字 </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classdev_1_1net_1_1detail_1_1_select_reactor.html#a754ba1aacd7171e7f551a5e92fca23bb">dev::net::detail::SelectReactor</a>, and <a class="el" href="classdev_1_1net_1_1detail_1_1_e_poll_reactor.html#a89aee7fbc4facb84614d1d6bd35b14df">dev::net::detail::EPollReactor</a>.</p>

</div>
</div>
<a class="anchor" id="aba6f59dcdb9f1d73f11e022ef6af502b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void dev::net::Reactor::setHeartBeatTime </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>time</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置反应器心跳时间 </p>
<dl class="section return"><dt>Returns</dt><dd>int </dd></dl>

</div>
</div>
<a class="anchor" id="a9ddff658f29b6d51a9f06c96a8176766"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void dev::net::Reactor::setStatus </td>
          <td>(</td>
          <td class="paramtype">Status&#160;</td>
          <td class="paramname"><em>status</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>设置反应器状态 </p>
<dl class="section return"><dt>Returns</dt><dd>Status </dd></dl>

</div>
</div>
<a class="anchor" id="a82d3315e9f4a00eff67ea868ab7e0b6b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void dev::net::Reactor::tick </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>执行一次网络事件 </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timeout</td><td>检查网络事件的超时时间 </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="classdev_1_1net_1_1detail_1_1_select_reactor.html#a4f46d46b326a7a4f1a88c79032ace5ea">dev::net::detail::SelectReactor</a>, and <a class="el" href="classdev_1_1net_1_1detail_1_1_e_poll_reactor.html#a09b95e05048965654a029b529f74d8a0">dev::net::detail::EPollReactor</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>dev/dev/net/<a class="el" href="_reactor_8hpp_source.html">Reactor.hpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>dev</b></li><li class="navelem"><b>net</b></li><li class="navelem"><a class="el" href="classdev_1_1net_1_1_reactor.html">Reactor</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.10 </li>
  </ul>
</div>
</body>
</html>
